<?
	include("../main_inc.php");
	if($_POST['Submit']){
		if($_POST['password']==$_POST['password2']){
			$m= new UpdateDatabase();
			$m->AddPosts($_POST,$_FILES);
			$m->AddSkip(array("id"));
			$m->AddTable("affiliate");
			$m->AddID($_SESSION["AffKey"]);
			$m->AddNoDupe(array("email"));
			$m->AddDefaultCheckBoxes(array("gst"));
			$m->DoStuff();
			$Message=" - Account Updated";
		};
	};
	
	$r->AddTable("affiliate");
	$r->AddSearchVar($_SESSION["AffKey"]);
	$Insert=$r->GetRecord();

?><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Bubble Affiliate Program</title>

<link href="../../css/admin.css" rel="stylesheet" type="text/css">
<script src="../../jscript/menuArrayAffiliate.php" language="javascript"></script>
<script src="../../jscript/clock.js" language="javascript"></script>
<script>
	function SetPaymentType(){
		var PType=document.getElementById("paymentMethod").value;
		if(PType=="Deposit"){
			var CBank="";
			var CCheque="none";
		}else{
			var CBank="none";
			var CCheque="";
		}
		for(x=1;x<5;x++){
			document.getElementById("bankRow"+x).style.display=CBank;
		}
		for(x=1;x<7;x++){
			document.getElementById("chqRow"+x).style.display=CCheque;
		}
	}
</script>
</head>

<body onLoad="funClock();SetPaymentType()">
<?php include("../header.php"); ?>
<table width="100%" border="0" cellspacing="25" cellpadding="0">
<tr>
<td valign="top" width="240"><div id="menu"><?php include("../menu.php"); ?></div></td>
<td valign="top" align="center">


  <div id="titleCompact">Affiliate Account  Details </div>
  <div id="contentCompact">


  <form name="form1" method="post" action="account.php">
    <table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#E9EEF5">
      <tr id="formHeader2">
        <td><strong>Modify Affiliate Account Details </strong><strong></strong>
            <?=$Message;?></td>
      </tr>
      <tr>
        <td align="center" bgcolor="#FFFFFF"><table width="400" border="0" cellspacing="0" cellpadding="4">
            <tr>
              <td width="130" height="30">Company Name:</td>
              <td width="354"><input name="companyName" type="text" class="formFields" id="companyName" value="<?=$Insert['companyName'];?>" size="40"></td>
            </tr>
            <tr>
              <td height="30">Contact Name:</td>
              <td><input name="contactName" type="text" class="formFields" id="contactName" value="<?=$Insert['contactName'];?>" size="40"></td>
            </tr>
            <tr>
              <td height="30">Email Address: </td>
              <td><input name="email" type="text" class="formFields" id="email" value="<?=$Insert['email'];?>" size="40"></td>
            </tr>
            <tr>
              <td height="30">Phone:</td>
              <td><input name="phone" type="text" class="formFields" id="phone" value="<?=$Insert['phone'];?>" size="40"></td>
            </tr>
            <tr>
              <td height="30">Username:</td>
              <td><input name="username" type="text" class="formFields" id="username" value="<?=$Insert['username'];?>" size="40"></td>
            </tr>
            <tr>
              <td>Password:</td>
              <td><input name="password" type="password" class="formFields" id="password" value="<?=$Insert['password'];?>" size="40"></td>
            </tr>
            <tr>
              <td>Confirm Password:</td>
              <td><input name="password2" type="password" class="formFields" id="password2" value="<?=$Insert['password'];?>" size="40"></td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td><input name="Submit2" type="submit" id="Submit2" value="Modify Account Details" class="formButtonSubmit"></td>
            </tr>
        </table></td>
      </tr>
    </table>
    <br>
    <br>
      <table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#E9EEF5">
        <tr id="formHeader">
          <td><strong>Modify Payment Details </strong><strong></strong></td>
        </tr>
        <tr>
          <td align="center" bgcolor="#FFFFFF"><table width="400" border="0" cellspacing="0" cellpadding="4">
              <tr>
                <td width="130" height="30">Select Payment Method:</td>
                <td width="354"><select name="paymentMethod" class="formFields"  id="paymentMethod" onChange="SetPaymentType()">
                    <option value="Deposit" <?=($Insert['paymentMethod']=="Deposit" ? "selected" :"");?>>Direct Deposit</option>
                    <option value="Cheque" <?=($Insert['paymentMethod']=="Cheque" ? "selected" :"");?>>Pay By Cheque</option>
                  </select>                </td>
              </tr>
              <tr id="bankRow1">
                <td height="30">Bank Name: </td>
                <td><input name="bankName" type="text" class="formFields" id="bankName" value="<?=$Insert['bankName'];?>" size="40"></td>
              </tr>
              <tr id="bankRow2">
                <td height="30">Name On Account: </td>
                <td><input name="bankAccount" type="text" class="formFields" id="bankAccount" value="<?=$Insert['bankAccount'];?>" size="40"></td>
              </tr>
              <tr id="bankRow3">
                <td height="30">BSB:</td>
                <td><input name="bankBsb" type="text" class="formFields" id="bankBsb" value="<?=$Insert['bankBsb'];?>" size="40"></td>
              </tr>
              <tr id="bankRow4">
                <td height="30">Account Number: </td>
                <td><input name="bankNumber" type="text" class="formFields" id="bankNumber" value="<?=$Insert['bankNumber'];?>" size="40"></td>
              </tr>
              <tr id="chqRow1">
                <td height="30">Address</td>
                <td><input name="chqAddress" type="text" class="formFields" id="chqAddress" value="<?=$Insert['chqAddress'];?>" size="40"></td>
              </tr>
              <tr id="chqRow2">
                <td height="30">Suburb</td>
                <td><input name="chqSuburb" type="text" class="formFields" id="chqSuburb" value="<?=$Insert['chqSuburb'];?>" size="40"></td>
              </tr>
              <tr id="chqRow3">
                <td height="30">State</td>
                <td><input name="chqState" type="text" class="formFields" id="chqState" value="<?=$Insert['chqState'];?>" size="40"></td>
              </tr>
              <tr id="chqRow4">
                <td height="30">Country</td>
                <td><input name="chqCountry" type="text" class="formFields" id="chqCountry" value="<?=$Insert['chqCountry'];?>" size="40"></td>
              </tr>
              <tr id="chqRow5">
                <td height="30">PostCode</td>
                <td><input name="chqPostcode" type="text" class="formFields" id="chqPostcode" value="<?=$Insert['chqPostcode'];?>" size="40"></td>
              </tr>
              <tr id="chqRow6">
                <td height="30">Name On Cheque</td>
                <td><input name="chqName" type="text" class="formFields" id="chqName" value="<?=$Insert['chqName'];?>" size="40"></td>
              </tr>
              <tr>
                <td height="30">GST:</td>
                <td><input name="gst" type="checkbox" id="gst" value="1" <?=($Insert['gst']==1 ? "checked" :"");?>>
                  I am eligible to collect GST </td>
              </tr>
              <tr>
                <td>ABN:</td>
                <td><input name="abn" type="text" class="formFields" id="abn" value="<?=$Insert['abn'];?>" size="40"></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td><input name="Submit" type="submit" id="Submit" value="Modify Payment Details" class="formButtonSubmit"></td>
              </tr>
          </table></td>
        </tr>
      </table>
  </form>
</div>
  <br>  </td>
</tr>
</table>
</body>
</html>
